home *** CD-ROM | disk | FTP | other *** search
/ The Best of Down Under Games / The Best of Down Under Games.iso / 3dfx Screen Savers / Chrome / NEW.C < prev    next >
C/C++ Source or Header  |  1997-05-30  |  2KB  |  112 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5.  
  6. int facepoly,facevert;
  7.  
  8.  
  9. int            _3DXFORM=1;    /*XX*/
  10. #define        MAXVERTEX    750
  11. #define        MAXFACE        1400
  12. #define        rad        0.01745329
  13. #define        MAX        1300    /*XX*/
  14. #define        START_SCANLINE     0    /*XX*/
  15. #define        END_SCANLINE       200    /*XX*/
  16. #define        X    0
  17. #define        Y    1
  18. #define        Z    2
  19. #define        LEFT_ENTRY 0
  20. #define        RITE_ENTRY 4
  21. #define        unitScale    127.0    /*XX*/
  22. #define        pixelScale    191.0    /*XX*/
  23. #define        arccos_size     256
  24. #define        VERTEXfile     "vertex.dat"
  25. #define     FACETfile      "facet.dat"
  26. #define        VNORMfile    "VNORM.DAT"
  27. #define     PALfile           "MOTION.PAL"
  28. #define        NBINS        400
  29. #define        BINSIZE        64
  30. #define        BINSIZELOG2    6
  31. #define        BLUR_LEVEL    1
  32. #define        MATRIX3D_RESOLUTION 10
  33.  
  34.  
  35.     short int    VERTEX,FACE;    /*XX*/
  36.     short int    fobject[MAXVERTEX][3];
  37.     short int pt[MAXVERTEX][4],facet[MAXFACE][3],current_bin;
  38.  
  39. void    loadobject()
  40. {
  41.         int i;
  42.     FILE *f;
  43.  
  44.   for (i=0;i<MAXVERTEX;i++)
  45.     fobject[i][0] = 9999;
  46.  
  47.   for (i=0;i<MAXFACE;i++)
  48.     facet[i][0] = 9999;
  49.  
  50.     f=fopen(VERTEXfile,"rb");
  51.  
  52.     printf("fopen = %d\n",f);
  53.  
  54.     fseek(f,-2L,SEEK_END);
  55.     fread(&VERTEX,1,2,f);    /*XX*/
  56.  
  57.     printf("no vertex = %d\n",VERTEX);
  58.     if(VERTEX>MAXVERTEX) { VERTEX=MAXVERTEX; }
  59.     fseek(f,0,SEEK_SET);
  60.     fread(fobject,1,VERTEX*3*2,f);
  61.     fclose(f);
  62.  
  63.  
  64.  
  65.     f=fopen(FACETfile,"rb");
  66.     printf("Factetfile = %d\n",FACETfile);
  67.     fseek(f,-2L,SEEK_END);
  68.     fread(&FACE,1,2,f);    /*XX*/
  69.     printf("Facets = %d\n",FACE);
  70.     if(FACE>MAXFACE) { FACE=MAXFACE; }
  71.     fseek(f,0,SEEK_SET);
  72.     fread(facet,1,FACE*3*2,f);
  73.     fclose(f);
  74.  
  75.     printf("\n%d vertices loaded.\n%d facets loaded\n",VERTEX,FACE);
  76.  
  77.   
  78.  
  79.     for (i=0;i<MAXVERTEX && fobject [i][0] != 9999;i++)
  80.         {
  81.         /*printf("vertex %d    %d %d %d\n",i,
  82.           fobject[i][0],
  83.           fobject[i][1], 
  84.           fobject[i][2]);*/
  85.            facevert = i+1;
  86.         }
  87.  
  88.     for (i=0;i<MAXFACE && facet[i][0] != 9999;i++)
  89.         {
  90.           /*printf("facet %d  %d %d %d\n",i,
  91.                   facet[i][0], facet[i][1], facet[i][2]);*/
  92.           facepoly = i+1;
  93.         }
  94.     
  95.       printf("max face %d   max vert %d \n",facepoly, facevert);
  96. }
  97.  
  98. /*
  99. main ()
  100. {
  101. int i;
  102.  
  103.   for (i=0;i<MAXVERTEX;i++)
  104.     fobject[i][0] = 9999;
  105.  
  106.   for (i=0;i<MAXFACE;i++)
  107.     facet[i][0] = 9999;
  108. loadfobject();
  109. exit (0);
  110. }
  111. */
  112.